package pri.black.garden.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.LinkedList;
import java.util.List;

@Data
@TableName("garden_plan")
public class Plan {
    @TableId(type = IdType.AUTO)
    private Long id;

    @TableField("pid")
    private Long pid;

    @TableField("name")
    private String name;

    @TableField("description")
    private String description;

    @TableField("create_time")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDateTime createTime;

    @TableLogic(value = "0", delval = "1")
    @TableField("del_flag")
    private Integer delFlag;

    @TableField("plan_start")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime planStart;

    @TableField("plan_end")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime planEnd;

    /**
     * 0 未完成 1 已完成
     */
    @TableField("state")
    private Integer state;

    @TableField(exist = false)
    private List<Long> blockIds = new LinkedList<>();

    @TableField(exist = false)
    private List<Block> blocks = new LinkedList<>();

    @TableField(exist = false)
    private List<Long> plantIds = new LinkedList<>();

    @TableField(exist = false)
    private List<Vegetables> plants = new LinkedList<>();
}
